{% extends "base.volt" %}

{% block pageFooter%}
<script type="text/javascript">
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
    </script>
    {{ javascript_include("/assets/manage/js/om/bannerList.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_om") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>Banner位管理</li>
            <li class="active">首页轮播</li>
        </ol>

		<div class="panel panel-default">
            <div class="panel-body">
                <form class="form-inline" role="form" action="" method="get">
                    <div class="form-group">
                        <div class="input-group">
                        	<label class="input-group-addon" for="">类型:</label>
                        	<select class="form-control item_link_type" name="banner_name">
                        		<option value="-10000">全部</option>
                                <option value="1" {{ banner_name == 1 ? 'selected="selected"' : '' }}>首页Banner</option>
                                <option value="2" {{ banner_name == 2 ? 'selected="selected"' : '' }}>问答Banner</option>
                                <option value="3" {{ banner_name == 3 ? 'selected="selected"' : '' }}>美容院Banner</option>
                            </select>
                    	</div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon">城市</label>
                            <select class="form-control" name="filterCity" id="filterCity">
                            	<option value="-10000">请选择</option>
                                <option value="0" {{ filterCity == 0 ? 'selected="selected"' : '' }}>全国</option>
                                {% for oc in openCity %}
                                    <option value="{{ oc.city_id }}" {{ filterCity == oc.city_id ? 'selected="selected"' : '' }} >{{ oc.city_name|e }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-filter"></i> 搜 索</button>
                    </div>
                </form>
            </div>
        </div>


        <table class="table table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>图片</th>
                <th>类型</th>
                <th>城市</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            </thead>
            {% for d in data %}
            <tr>
                <td>{{ d['banner_id'] }}</td>
                <td>
                <img style="width:90px;height:90px;" src="{{ this.di.get('appConfig').application.domainPic }}{{ d['banner_data']['url'] }}"/></td>
                <td>
                	{%if d['banner_name']  == '1'%}
                		首页
                	{%elseif d['banner_name']  == '2'%}
                		问答
                	{%elseif d['banner_name']  == '3'%}
                		美容院
                	{%endif%}
                </td>
                <td>
                	{%if d['city_name'] == null%}
                    	全国
                    {%else%}
                    	{{ d['city_name']|e }}
                    {%endif%}
                </td>
                <td>{{ d['banner_addtime'] }}</td>
                <td>
                    <div class="dropdown">
                        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu{{ d['city_id'] }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-cogs"></i> 操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" aria-labelledby="dropdownMenu{{ d['city_id'] }}">
                            <li><a href="{{ url.get('om/bannerEdit',['banner_id':d['banner_id']]) }}"><i class="fa fa-pencil fa-fw"></i>编辑</a></li>
                            <li><a href="javascript:void(0)" did="{{ d['banner_id'] }}" dstate="-1" class="delete" durl="{{ url.get('om/bannerDelete') }}"><i class="fa fa-trash-o fa-fw"></i> 删 除</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            {% endfor %}
        </table>
        {{ this.tagNav.page(
        page,
        total,
        limit,
        url.get('om/bannerList', [
        'filterCity': filterCity,
        'banner_name':banner_name,
        'page': '__PAGE__'
        ]
        )) }}
    </div>
{% endblock %}